package com.nsxy.manager.login.beans;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;

import com.nsxy.common.beans.BaseEntity;
import com.nsxy.manager.user.beans.Account;

/**
 * 登录日志
 * @author 潜行的青衣
 * @see
 */
@Entity
@Table(name="t_manager_loginlog")
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
public class LoginLog extends BaseEntity<String> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 563248228675187447L;
	
	public final static byte STATUS_SUCCESS = 1;		//生效
	
	public final static byte STATUS_FAILURE = 0;		//失效
	
	@Id
	@GeneratedValue(generator = "system-uuid")
	@GenericGenerator(name = "system-uuid", strategy = "uuid")
	@Column(length = 32)
	private String id;
	
	@Column(length = 1)
	private byte status;
	
	@Column(name="acc_id", length = 32)
	private String accId;
	
	@Column(length = 19)
	private String logintime;
	
	@Column(length = 10)
	private String extra1;
	
	@Column(length = 10)
	private String extra2;
	
	@Column(length = 10)
	private String extra3;
	
	@Column(length = 10)
	private String extra4;

	@OneToOne
	@JoinColumn(name="acc_id", insertable=false, updatable=false)
	private Account account;
	
	/* (non-Javadoc)
	 * @see com.nsxy.common.beans.BaseEntity#getId()
	 */
	@Override
	public String getId() {
		return this.id;
	}

	public byte getStatus() {
		return status;
	}

	public void setStatus(byte status) {
		this.status = status;
	}

	public String getLogintime() {
		return logintime;
	}

	public void setLogintime(String logintime) {
		this.logintime = logintime;
	}

	public String getExtra1() {
		return extra1;
	}

	public void setExtra1(String extra1) {
		this.extra1 = extra1;
	}

	public String getExtra2() {
		return extra2;
	}

	public void setExtra2(String extra2) {
		this.extra2 = extra2;
	}

	public String getExtra3() {
		return extra3;
	}

	public void setExtra3(String extra3) {
		this.extra3 = extra3;
	}

	public String getExtra4() {
		return extra4;
	}

	public void setExtra4(String extra4) {
		this.extra4 = extra4;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Account getAccount() {
		return account;
	}

	public void setAccount(Account account) {
		this.account = account;
	}

	public String getAccId() {
		return accId;
	}

	public void setAccId(String accId) {
		this.accId = accId;
	}
	
}
